package com.example.myapplication.base;

/**
 * 请求结果类，保存返回数据
 * <p>
 */
public class DataResult<T> {
//    private String status;  //请求状态
    private String msg;  //请求消息
    private int code;    //类型
    private int ret;
    private String error;
    private T data;     //请求返回的数据

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    private int count;

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }


    public DataResult(T data) {
        this.msg = "Request succeeded";
        this.data = data;
    }


    public String getMsg() {
        if (msg == null) return "no Msg";
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return ret;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "DataResult{" +
//                "status=" + status +
                ", msg='" + msg + '\'' +
                ", code=" + code +
                ", data=" + data +
                '}';
    }
}
